1 Imports System.Data.SqlClient
2 Imports System.Security.Cryptography
3 Imports System.Text
4 Imports System.IO
5 Public Class frmStaffPayment
6 Sub Reset()
7 DateFrom.value = Today
8 DateTo.value = Today
9 StaffID.Text = ""
10 StaffName.Text = ""
11 Designation.Text = ""
12 Salary.Text = ""
13 PresentDays.Text = ""
14 Advance.Text = ""
15 Deduction.Text = ""
16 PaymentDate.Text = Now
17 paymentmode.SelectedIndex = -1
18 PaymentModeDetails.Text = ""
19 NetPay.Text = ""
20 PaymentID.Text = ""
21 txtStaff.Text = ""
22 txtStaff.Text = ""
23 GetData()
24 btnSave.Enabled = True
25 btnDelete.Enabled = False
26 btnUpdate.Enabled = False
27 btnPrint.Enabled = False
28 DateFrom.Enabled = True
29 DateTo.Enabled = True
30 PaymentDate.Enabled = True
31 Deduction.ReadOnly = False
32 dgw.Enabled = True
33 auto()
34 End Sub
35 Sub GetData()
36 Try
37 con = New SqlConnection(cs)
38 con.Open()
39 Dim sql As String = "SELECT RTRIM(Staff.St_ID) ,RTRIM(Staff.StaffID),RTRIM(StaffName),RTRIM(Designation),RTRIM(Salary) from Staff order by StaffName"
40 cmd = New SqlCommand(sql, con)
41 rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
42 dgw.Rows.Clear()
43 While (rdr.Read() = True)
44 dgw.Rows.Add(rdr(0), rdr(1), rdr(2), rdr(3), rdr(4))
45 End While
46 con.Close()
47 Catch ex As Exception
48 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
49 End Try
50 End Sub
51 Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click
52 Try
53 If Len(Trim(StaffID.Text)) = 0 Then
54 MessageBox.Show("Please retrieve Staff id", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
55 StaffID.Focus()
56 Exit Sub
57 End If
58 If Len(Trim(paymentmode.Text)) = 0 Then
59 MessageBox.Show("Please select payment mode", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
60 paymentmode.Focus()
61 Exit Sub
62 End If
63 If Advance.Text = Nothing Then
64 Advance.Text = 0
65 End If
66 If Val(Advance.Text) < Val(Deduction.Text) Then
67 MessageBox.Show("You can not deduct amount more than advance amount", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
68 Deduction.Focus()
69 Exit Sub
70 End If
71 If Val(NetPay.Text) < 0 Then
72 MessageBox.Show("net pay should be more than 0", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
73 Exit Sub
74 End If
75 If DateTo.Value.Date < DateFrom.Value.Date Then
76 MessageBox.Show("Selected 'Date To' must be greater than 'Date From'", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
77 DateTo.Focus()
78 Exit Sub
79 End If
80 If DateTo.Value.Date = DateFrom.Value.Date Then
81 MessageBox.Show("Selected 'Date From' is equal to 'Date To'", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
82 DateFrom.Focus()
83 Exit Sub
84 End If
85 con = New SqlConnection(cs)
86 con.Open()
87 Dim ct As String = "SELECT * FROM StaffPayment WHERE DateFrom <= @d1 AND DateTo >= @d2 and StaffID=" & txtStID.Text & ""
88 cmd = New SqlCommand(ct)
89 cmd.Parameters.AddWithValue("@d1", DateTo.Value.Date)
90 cmd.Parameters.AddWithValue("@d2", DateFrom.Value.Date)
91 cmd.Connection = con
92 rdr = cmd.ExecuteReader()
93 If rdr.Read Then
94 MessageBox.Show("Salary already paid..Select correct payment date", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
95 If Not rdr Is Nothing Then
96 rdr.Close()
97 End If
98 Exit Sub
99 End If
100 con = New SqlConnection(cs)
101 con.Open()
102 Dim cb As String = "insert into Staffpayment(ID,PaymentID,DateFrom,DateTo,StaffID,PresentDays,Salary,Advance,Deduction,PaymentDate,ModeOfPayment,PaymentModeDetails,Netpay) values(" & txtID.Text & ",@d1,@d2,@d3,@d4,@d5,@d6,@d7,@d8,@d9,@d10,@d11,@d12)"
103 cmd = New SqlCommand(cb)
104 cmd.Connection = con
105 cmd.Parameters.AddWithValue("@d1", PaymentID.Text)
106 cmd.Parameters.AddWithValue("@d2", DateFrom.Text)
107 cmd.Parameters.AddWithValue("@d3", DateTo.Text)
108 cmd.Parameters.AddWithValue("@d4", txtStID.Text)
109 cmd.Parameters.AddWithValue("@d5", PresentDays.Text)
110 cmd.Parameters.AddWithValue("@d6", Salary.Text)
111 cmd.Parameters.AddWithValue("@d7", Advance.Text)
112 cmd.Parameters.AddWithValue("@d8", Deduction.Text)
113 cmd.Parameters.AddWithValue("@d9", PaymentDate.Value)
114 cmd.Parameters.AddWithValue("@d10", paymentmode.Text)
115 cmd.Parameters.AddWithValue("@d11", PaymentModeDetails.Text)
116 cmd.Parameters.AddWithValue("@d12", NetPay.Text)
117 cmd.ExecuteNonQuery()
118 con.Close()
119 auto1()
120 con = New SqlConnection(cs)
121 con.Open()
122 Dim cb2 As String = "insert into advanceentry(ID,workingdate,StaffID,amount,deduction) VALUES (" & txtID1.Text & ",@d1,@d2,@d3,@d4)"
123 cmd = New SqlCommand(cb2)
124 cmd.Connection = con
125 cmd.Parameters.AddWithValue("@d1", PaymentDate.Value)
126 cmd.Parameters.AddWithValue("@d2", txtStID.Text)
127 cmd.Parameters.AddWithValue("@d3", 0)
128 cmd.Parameters.AddWithValue("@d4", Deduction.Text)
129 cmd.ExecuteReader()
130 con.Close()
131 Dim st As String = "added the new payment entry having payment id '" & PaymentID.Text & "'"
132 LogFunc(lblUser.Text, st)
133 MessageBox.Show("Successfully paid", "Staff", MessageBoxButtons.OK, MessageBoxIcon.Information)
134 btnSave.Enabled = False
135 con.Close()
136 Print()
137 Catch ex As Exception
138 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
139 End Try
140 End Sub
141
142 Private Sub btnUpdate_Click(sender As System.Object, e As System.EventArgs) Handles btnUpdate.Click
143
144 Try
145 If Len(Trim(StaffID.Text)) = 0 Then
146 MessageBox.Show("Please retrieve Staff id", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
147 StaffID.Focus()
148 Exit Sub
149 End If
150 If Len(Trim(paymentmode.Text)) = 0 Then
151 MessageBox.Show("Please select payment mode", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
152 paymentmode.Focus()
153 Exit Sub
154 End If
155 If Advance.Text = Nothing Then
156 Advance.Text = 0
157 End If
158 If Val(Advance.Text) < Val(Deduction.Text) Then
159 MessageBox.Show("You can not deduct amount more than advance amount", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
160 Deduction.Focus()
161 Exit Sub
162 End If
163 If Val(NetPay.Text) < 0 Then
164 MessageBox.Show("net pay should be more than 0", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
165 Exit Sub
166 End If
167 If DateTo.Value.Date < DateFrom.Value.Date Then
168 MessageBox.Show("Selected 'Date To' must be greater than 'Date From'", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
169 DateTo.Focus()
170 Exit Sub
171 End If
172 If DateTo.Value.Date = DateFrom.Value.Date Then
173 MessageBox.Show("Selected 'Date From' is equal to 'Date To'", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
174 DateFrom.Focus()
175 Exit Sub
176 End If
177 con = New SqlConnection(cs)
178 con.Open()
179 Dim cb As String = "update Staffpayment set PaymentID=@d1,StaffID=@d4,PresentDays=@d5,Salary=@d6,Advance=@d7,Deduction=@d8,ModeOfPayment=@d9,PaymentModeDetails=@d10,Netpay=@d11 where ID=" & txtID.Text & ""
180 cmd = New SqlCommand(cb)
181 cmd.Connection = con
182 cmd.Parameters.AddWithValue("@d1", PaymentID.Text)
183 cmd.Parameters.AddWithValue("@d4", txtStID.Text)
184 cmd.Parameters.AddWithValue("@d5", PresentDays.Text)
185 cmd.Parameters.AddWithValue("@d6", Salary.Text)
186 cmd.Parameters.AddWithValue("@d7", Advance.Text)
187 cmd.Parameters.AddWithValue("@d8", Deduction.Text)
188 cmd.Parameters.AddWithValue("@d9", paymentmode.Text)
189 cmd.Parameters.AddWithValue("@d10", PaymentModeDetails.Text)
190 cmd.Parameters.AddWithValue("@d11", NetPay.Text)
191 cmd.ExecuteNonQuery()
192 con.Close()
193 Dim st As String = "updated the payment entry having payment id '" & PaymentID.Text & "'"
194 LogFunc(lblUser.Text, st)
195 MessageBox.Show("Successfully updated", "Entry", MessageBoxButtons.OK, MessageBoxIcon.Information)
196 btnUpdate.Enabled = False
197 con.Close()
198 Catch ex As Exception
199 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
200 End Try
201 End Sub
202
203 Private Sub btnDelete_Click(sender As System.Object, e As System.EventArgs) Handles btnDelete.Click
204 Try
205 If MessageBox.Show("Do you really want to delete this record?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = Windows.Forms.DialogResult.Yes Then
206 DeleteRecord()
207 End If
208 Catch ex As Exception
209 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
210 End Try
211 End Sub
212 Private Sub DeleteRecord()
213 Try
214 Dim RowsAffected As Integer = 0
215 con = New SqlConnection(cs)
216 con.Open()
217 Dim cq As String = "delete from StaffPayment where id=" & txtID.Text & ""
218 cmd = New SqlCommand(cq)
219 cmd.Connection = con
220 RowsAffected = cmd.ExecuteNonQuery()
221 If RowsAffected > 0 Then
222 Dim st As String = "deleted the payment entry having payment id '" & PaymentID.Text & "'"
223 LogFunc(lblUser.Text, st)
224 MessageBox.Show("Successfully deleted", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information)
225 GetData()
226 Reset()
227 Reset()
228 Else
229 MessageBox.Show("No Record found", "Sorry", MessageBoxButtons.OK, MessageBoxIcon.Information)
230 Reset()
231 End If
232 If con.State = ConnectionState.Open Then
233 con.Close()
234
235 End If
236 Catch ex As Exception
237 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.[Error])
238 End Try
239 End Sub
240
241 Private Sub btnClose_Click(sender As System.Object, e As System.EventArgs) Handles btnClose.Click
242 Me.Close()
243 End Sub
244
245 Private Sub btnNew_Click(sender As System.Object, e As System.EventArgs) Handles btnNew.Click
246 Reset()
247 Reset()
248 End Sub
249
250 Private Sub frmAdvanceEntry_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
251 GetData()
252 End Sub
253 Sub Compute()
254 Try
255 Dim num1, num2 As Double
256 num1 = CDbl((Val(txtSalary.Text) * Val(PresentDays.Text)) / 30)
257 num1 = Math.Round(num1, 2)
258 Salary.Text = num1
259 num2 = CDbl(Val(Salary.Text) - Val(Deduction.Text))
260 num2 = Math.Round(num2, 2)
261 NetPay.Text = num2
262 Catch ex As Exception
263 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
264 End Try
265 End Sub
266 Private Sub dgw_MouseClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles dgw.MouseClick
267 Try
268 If DateTo.Value.Date < DateFrom.Value.Date Then
269 MessageBox.Show("Selected 'Date To' must be greater than 'Date From'", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
270 DateTo.Focus()
271 Exit Sub
272 End If
273 If DateTo.Value.Date = DateFrom.Value.Date Then
274 MessageBox.Show("Selected 'Date From' is equal to 'Date To'", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
275 DateFrom.Focus()
276 Exit Sub
277 End If
278 Dim dr As DataGridViewRow = dgw.SelectedRows(0)
279 con = New SqlConnection(cs)
280 con.Open()
281 Dim ct As String = "SELECT * FROM StaffPayment WHERE DateFrom <= @d1 AND DateTo >= @d2 and StaffID=" & dr.Cells(0).Value & ""
282 cmd = New SqlCommand(ct)
283 cmd.Parameters.AddWithValue("@d1", DateTo.Value.Date)
284 cmd.Parameters.AddWithValue("@d2", DateFrom.Value.Date)
285 cmd.Connection = con
286 rdr = cmd.ExecuteReader()
287 If rdr.Read Then
288 MessageBox.Show("Salary already paid..Select correct payment date", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
289 If Not rdr Is Nothing Then
290 rdr.Close()
291 End If
292 Exit Sub
293 End If
294 con.Close()
295 txtStID.Text = dr.Cells(0).Value.ToString
296 StaffID.Text = dr.Cells(1).Value.ToString
297 StaffName.Text = dr.Cells(2).Value.ToString
298 Designation.Text = dr.Cells(3).Value.ToString
299 txtSalary.Text = dr.Cells(4).Value.ToString
300 con.Open()
301 Dim cp As String = "select count(status) from StaffAttendance where WorkingDate between @d1 and @d2 and status='P' and StaffID=" & txtStID.Text & ""
302 cmd = New SqlCommand(cp)
303 cmd.Connection = con
304 cmd.Parameters.Add("@d1", SqlDbType.DateTime, 30, "DateIN").Value = DateFrom.Value.Date
305 cmd.Parameters.Add("@d2", SqlDbType.DateTime, 30, "DateIN").Value = DateTo.Value.Date
306 Dim result = cmd.ExecuteScalar()
307 PresentDays.Text = Convert.ToString(result)
308 Dim num1 As Double
309 num1 = CDbl((Val(txtSalary.Text) * Val(PresentDays.Text)) / 30)
310 num1 = Math.Round(num1, 2)
311 Salary.Text = num1
312 If con.State = ConnectionState.Open Then
313 con.Close()
314 End If
315 con.Open()
316 Dim cp1 As String = "select sum(amount)-sum(deduction) from advanceentry where StaffID=" & txtStID.Text & ""
317 cmd = New SqlCommand(cp1)
318 cmd.Connection = con
319 Dim result1 = cmd.ExecuteScalar()
320 Advance.Text = Convert.ToString(result1)
321 If Advance.Text = Nothing Then
322 Advance.Text = 0
323 End If
324 If con.State = ConnectionState.Open Then
325 con.Close()
326 End If
327 Deduction.Focus()
328 Catch ex As Exception
329 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
330 End Try
331 End Sub
332
333 Private Sub dgw_RowPostPaint(sender As Object, e As System.Windows.Forms.DataGridViewRowPostPaintEventArgs) Handles dgw.RowPostPaint
334 Dim strRowNumber As String = (e.RowIndex + 1).ToString()
335 Dim size As SizeF = e.Graphics.MeasureString(strRowNumber, Me.Font)
336 If dgw.RowHeadersWidth < Convert.ToInt32((size.Width + 20)) Then
337 dgw.RowHeadersWidth = Convert.ToInt32((size.Width + 20))
338 End If
339 Dim b As Brush = SystemBrushes.ControlText
340 e.Graphics.DrawString(strRowNumber, Me.Font, b, e.RowBounds.Location.X + 15, e.RowBounds.Location.Y + ((e.RowBounds.Height - size.Height) / 2))
341
342 End Sub
343 Private Sub auto1()
344 Dim Num As Integer = 0
345 con = New SqlConnection(cs)
346 con.Open()
347 Dim sql As String = ("SELECT MAX(ID) FROM AdvanceEntry")
348 cmd = New SqlCommand(sql)
349 cmd.Connection = con
350 If (IsDBNull(cmd.ExecuteScalar)) Then
351 Num = 1
352 txtID1.Text = Num.ToString
353 Else
354 Num = cmd.ExecuteScalar + 1
355 txtID1.Text = Num.ToString
356 End If
357 cmd.Dispose()
358 con.Close()
359 con.Dispose()
360 End Sub
361 Private Sub auto()
362 Dim Num As Integer = 0
363 con = New SqlConnection(cs)
364 con.Open()
365 Dim sql As String = ("SELECT MAX(ID) FROM StaffPayment")
366 cmd = New SqlCommand(sql)
367 cmd.Connection = con
368 If (IsDBNull(cmd.ExecuteScalar)) Then
369 Num = 1
370 txtID.Text = Num.ToString
371 PaymentID.Text = "P-" + Num.ToString
372 Else
373 Num = cmd.ExecuteScalar + 1
374 txtID.Text = Num.ToString
375 PaymentID.Text = "P-" + Num.ToString
376 End If
377 cmd.Dispose()
378 con.Close()
379 con.Dispose()
380 End Sub
381 Private Sub btnGetData_Click(sender As System.Object, e As System.EventArgs) Handles btnGetData.Click
382 frmStaffPaymentRecord.lblSet.Text = "Payment Entry"
383 frmStaffPaymentRecord.Reset()
384 frmStaffPaymentRecord.ShowDialog()
385 End Sub
386
387 Private Sub txtStaff_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtStaff.TextChanged
388 Try
389 con = New SqlConnection(cs)
390 con.Open()
391 Dim sql As String = "SELECT RTRIM(Staff.St_ID) ,RTRIM(Staff.StaffID),RTRIM(StaffName),RTRIM(Designation),RTRIM(Salary) from Staff where StaffName like '" & txtStaff.Text & "%' order by StaffName"
392 cmd = New SqlCommand(sql, con)
393 rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
394 dgw.Rows.Clear()
395 While (rdr.Read() = True)
396 dgw.Rows.Add(rdr(0), rdr(1), rdr(2), rdr(3), rdr(4))
397 End While
398 con.Close()
399 Catch ex As Exception
400 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
401 End Try
402 End Sub
403
404 Private Sub OvertimeRate_TextChanged(sender As System.Object, e As System.EventArgs)
405 Compute()
406 End Sub
407
408 Private Sub Deduction_TextChanged(sender As System.Object, e As System.EventArgs) Handles Deduction.TextChanged
409 Compute()
410 End Sub
411
412 Private Sub DateTo_Validating(sender As System.Object, e As System.ComponentModel.CancelEventArgs) Handles DateTo.Validating
413 If DateTo.Value.Date < DateFrom.Value.Date Then
414 MessageBox.Show("Selected 'Date To' must be greater than 'Date From'", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
415 DateTo.Focus()
416 Exit Sub
417 End If
418 If DateTo.Value.Date = DateFrom.Value.Date Then
419 MessageBox.Show("Selected 'Date To' is equal to 'Date From'", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
420 DateFrom.Focus()
421 Exit Sub
422 End If
423 End Sub
424 Sub Print()
425 Try
426 Cursor = Cursors.WaitCursor
427 Timer1.Enabled = True
428 Dim rpt As New rptSalarySlip 'The report you created.
429 Dim myConnection As SqlConnection
430 Dim MyCommand As New SqlCommand()
431 Dim myDA As New SqlDataAdapter()
432 Dim myDS As New DataSet 'The DataSet you created.
433 myConnection = New SqlConnection(cs)
434 MyCommand.Connection = myConnection
435 MyCommand.CommandText = "SELECT SchoolInfo.S_Id, SchoolInfo.SchoolName, SchoolInfo.Address, SchoolInfo.ContactNo, SchoolInfo.AltContactNo, SchoolInfo.FaxNo, SchoolInfo.Email, SchoolInfo.Website, SchoolInfo.Logo, SchoolInfo.RegistrationNo,SchoolInfo.DiseNo, SchoolInfo.IndexNo, SchoolInfo.EstablishedYear, SchoolInfo.Class, SchoolInfo.SchoolType, Staff.StaffID, Staff.StaffName, Staff.DateOfJoining, Staff.Gender, Staff.FatherName,Staff.TemporaryAddress, Staff.PermanentAddress, Staff.Designation, Staff.Qualifications, Staff.DOB, Staff.PhoneNo, Staff.MobileNo, Staff.Email AS Expr1, Staff.Photo, Staff.ClassType, Staff.SchoolID,Staff.AccountName, Staff.AccountNumber, Staff.Bank, Staff.Branch, Staff.IFSCcode, Staff.Status, StaffPayment.Id, StaffPayment.PaymentID, StaffPayment.DateFrom, StaffPayment.DateTo,StaffPayment.StaffID AS Expr2, StaffPayment.PresentDays, StaffPayment.Salary , StaffPayment.Advance, StaffPayment.Deduction, StaffPayment.PaymentDate, StaffPayment.ModeOfPayment,StaffPayment.PaymentModeDetails, StaffPayment.NetPay FROM SchoolInfo INNER JOIN Staff ON SchoolInfo.S_Id = Staff.SchoolID INNER JOIN StaffPayment ON Staff.St_ID = StaffPayment.StaffID where PaymentID='" & PaymentID.Text & "'"
436 MyCommand.CommandType = CommandType.Text
437 myDA.SelectCommand = MyCommand
438 myDA.Fill(myDS, "StaffPayment")
439 myDA.Fill(myDS, "Staff")
440 myDA.Fill(myDS, "SchoolInfo")
441 rpt.SetDataSource(myDS)
442 frmReport.CrystalReportViewer1.ReportSource = rpt
443 frmReport.ShowDialog()
444 Catch ex As Exception
445 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
446 End Try
447 End Sub
448
449 Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
450 Cursor = Cursors.Default
451 Timer1.Enabled = False
452 End Sub
453
454 Private Sub btnPrint_Click(sender As System.Object, e As System.EventArgs) Handles btnPrint.Click
455 Print()
456 End Sub
457
458 Private Sub Deduction_Validating(sender As System.Object, e As System.ComponentModel.CancelEventArgs) Handles Deduction.Validating
459 If Val(Advance.Text) < Val(Deduction.Text) Then
460 MessageBox.Show("You can not deduct amount more than advance amount", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
461 Deduction.Focus()
462 Exit Sub
463 End If
464 End Sub
465 End Class